@import './variables'; 
//reset 重置样式
* {
  box-sizing: border-box;
  outline: none;
}
html {
  font-size: 13px; //默认一般可能为16px
}
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.2em;
  background: #f1f1f1;
  -webkit-font-smoothing:antialiased;//苹果电脑上字体大小粗细
}
a {
  color: #999999;
}
p{
  line-height: 1.5rem;
  margin: 0;
}

@each $colorKey, $color in $colors {
  .text-#{$colorKey} {
    color: $color;
  }
  .bg-#{$colorKey} {
    background: $color;
  }
}

//text align
@each $var in (left, center, right) {
  //(left,center,right)这是一个集合
  .text-#{$var} {
    //相当于.text-left .text-center .text-right
    text-align: $var !important;
  }
}

@each $sizeKey, $size in $font-sizes {
  .fs-#{$sizeKey} {
    font-size: $size * $base-font-size;
  }
}

//text overflow
.text-ellipsis{
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
//width,height
.w-100{
  width: 100%;
}
.h-100{
  height: 100%;
}
//flex
.d-flex {
  display: flex;
}
.flex-column {
  flex-direction: column;
}
.flex-wrap{
  flex-wrap: wrap;
}

@each $key, $value in $flex-jc {
  .jc-#{$key} {
    justify-content: $value;
  }
}

@each $key, $value in $flex-ai {
  .ai-#{$key} {
    align-items: $value;
  }
}
.flex-1 {
  flex: 1;
}
.flex-grow-1 {
  flex-grow: 1;
}

//m-0,mx-0
@each $typeKey, $type in $spacing-types {
  //.m-1
  @each $sizeKey, $size in $spacing-sizes {
    .#{$typeKey}-#{$sizeKey} {
      #{$type}: $size * $spacing-base-size;
    }
  }
  //.mx-1,.my-1
  @each $sizeKey, $size in $spacing-sizes {
    .#{$typeKey}x-#{$sizeKey} {
      #{$type}-left: $size * $spacing-base-size;
      #{$type}-right: $size * $spacing-base-size;
    }
    .#{$typeKey}y-#{$sizeKey} {
      #{$type}-top: $size * $spacing-base-size;
      #{$type}-bottom: $size * $spacing-base-size;
    }
  }
  //.mt-1
  @each $directionKey, $direction in $spacing-directions {
    @each $sizeKey, $size in $spacing-sizes {
      //.mt-1{margin-top:0.25rem}
      .#{$typeKey}#{$directionKey}-#{$sizeKey} {
        #{$type}-#{$direction}: $size * $spacing-base-size;
      }
    }
  }
}

//button
.btn{
  border: none;
  border-radius: 0.1538rem;
  font-size: map-get($font-sizes,'sm')*$base-font-size;//map-get取到前面定义的font-size
  padding:0.2rem 0.6rem;
}
//nav
.nav{
  display: flex;
  .nav-item{
    border-bottom:2px solid transparent;//不加透明边框的话居中对齐对不齐
    padding-bottom: 0.2rem;
    &.active{
      color: map-get($colors, 'primary');
      border-bottom-color: map-get($colors, 'primary');
    }
  }
  &.nav-inverse{
    .nav-item{
      color: map-get($colors,'white');
      &.active{
        border-bottom-color: map-get($colors,'white');
      }
    }
  }
}


//sprite
.sprite{
  background: url(../images/index.png)no-repeat 0 0;//两个0表示左上角对齐
  background-size: 28.8462rem;
  display: inline-block;//要给i标签使用的
  &.sprite-news{
    width: 1.7692rem;
    height: 1.5385rem;
    background-position: 63.546% 15.517%;
  };
  &.sprite-story{
    width: 1.7692rem;
    height: 1.5385rem;
    background-position: 90.383% 15.614%;
  };
  &.sprite-shop{
    width: 1.4615rem;
    height: 1.6923rem;
    background-position: 36.746% 0.924%;
  }
  &.sprite-experience{
    width: 1.5385rem;
    height: 1.5385rem;
    background-position: 10.408% 15.517%;
  }
  &.sprite-newPlayer{
    width: 1.5385rem;
    height: 1.6154rem;
    background-position: 89.733% 1.266%;
  }
  &.sprite-gloryInheritance{
    width: 1.8462rem;
    height: 1.5385rem;
    background-position: 36.467% 15.287%;
  }
  &.sprite-community{
    width: 2rem;
    height: 1.6154rem;
    background-position: 9.728% 1.266%;
  }
  &.sprite-kingCamp{
    width: 1.8462rem;
    height: 1.8462rem;
    background-position: 63.3% 0.927%;
  }
  &.sprite-publicAddress{
    width: 1.8462rem;
    height: 1.5385rem;
    background-position: 0% 96.207%;
  }
  &.sprite-version{
    background: url(//game.gtimg.cn/images/yxzj/m/m201706/images/bg/version-icon.png);
    height: 1.8462rem;
    width: 26px;
  }
  &.sprite-arrow{
    width: 0.7692rem;
    height: 0.7692rem;
    background-position: 38.577% 52.076%;
  }
}

//borders
@each $dir in (top,right,bottom,left) {
  .border-#{$dir}{
    border-#{$dir}:1px solid $border-color;
  }
}

.bgc-white{
  background: white;
}

.clearFloat{
  zoom:1
}
.clearFloat::after{
  content: '';
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}